package com.example.mytayunapi.Mapper;

import com.example.mytayunapi.Entity.adviceInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface adviceInfoMapper {
    @Select("SELECT * FROM advice")
    List<adviceInfo> selectAllAdviceInfo();

    @Select("SELECT * FROM advice where Advice_id = #{Advice_id}")
    List<adviceInfo> selectAllAdviceInfoByAdviceId(Integer Advice_id);

    @Insert("INSERT INTO advice (Advice_id, Advice_content, Advice_man, Advice_time, Advice_phone, operator)\n" +
            "VALUES (#{Advice_id}, #{Advice_content}, #{Advice_man}, #{Advice_time}, #{Advice_phone}, #{operator});")
    Integer insertAdviceInfo(adviceInfo adviceInfo);

    @Delete("delete  from advice where Advice_id = #{Advice_id}")
    Integer deleteAdviceByID(Integer Advice_id);

    @Insert("insert into advice(Advice_content,Advice_Title,Advice_man,Advice_email,Advice_phone) values(#{Advice_content},#{Advice_Title},#{Advice_man},#{Advice_email},#{Advice_phone})")
    Integer insertAdviceContent(adviceInfo adviceinfo);
}
